# from functools import cache
from functools import lru_cache


class Solution:
    # 方法一：记忆化搜索 + 状态压缩
    def canIWin(self, maxChoosableInteger: int, desiredTotal: int) -> bool:
        # ImportError: cannot import name 'cache' from 'functools'
        # functools.cache的文档说明它只在Python3.9以后才可用
        # @cache
        @lru_cache(maxsize=None)
        def dfs(usedNumbers: int, currentTotal: int) -> bool:
            for i in range(maxChoosableInteger):
                if (usedNumbers >> i) & 1 == 0:
                    if currentTotal + i + 1 >= desiredTotal or not dfs(usedNumbers | (1 << i), currentTotal + i + 1):
                        return True
            return False

        return (1 + maxChoosableInteger) * maxChoosableInteger // 2 >= desiredTotal and dfs(0, 0)


def main():
    import sys
    import io
    def readlines():
        for line in io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8'):
            yield line.strip('\n')

    lines = readlines()
    while True:
        try:
            line = next(lines)
            maxChoosableInteger = int(line)
            line = next(lines)
            desiredTotal = int(line)

            ret = Solution().canIWin(maxChoosableInteger, desiredTotal)

            out = (ret)
            print(out)
        except StopIteration:
            break


if __name__ == '__main__':
    main()